# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-oneplus-bacon
pkgver=5
pkgrel=0
pkgdesc="OnePlus One"
url="https://postmarketos.org"
arch="armv7"
license="MIT"
depends="
	lk2nd-msm8974
	mkbootimg
	postmarketos-base
	soc-qcom-msm8974
	"
makedepends="devicepkg-dev"
subpackages="
	$pkgname-kernel-downstream:kernel_downstream
	$pkgname-kernel-mainline:kernel_mainline
	$pkgname-nonfree-firmware:nonfree_firmware
"
source="deviceinfo modules-initfs.mainline 90-android-touch-dev.rules"
options="!check !archcheck"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
	install -Dm644 "$srcdir"/90-android-touch-dev.rules \
		"$pkgdir"/etc/udev/rules.d/90-android-touch-dev.rules
}

kernel_downstream() {
	pkgdesc="Downstream kernel"
	depends="linux-oneplus-bacon msm-fb-refresher"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

kernel_mainline() {
	pkgdesc="Close to mainline kernel"
	depends="linux-postmarketos-qcom-msm8974"
	devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
}

nonfree_firmware() {
	pkgdesc="GPU, Wi-Fi firmware"
	depends="firmware-qcom-adreno-a330 firmware-oneplus-bacon"
	mkdir "$subpkgdir"
}

sha512sums="
4a7464e7dac8e1b7ed7d8f88e7222cde2df371e9813ecd9a17351a282e1654f4c60098b4a88f28aa0690718f898d77507e9a2cb56049175e7c2650d649034ef0  deviceinfo
fd639faebbee2c0c2c227710678376e0d039b7d96a62103f7ba7e6304d7060023f09064918e93a125465d20d125c0334225680521a7aeae5a43d77d7360c180c  modules-initfs.mainline
65e9ee7352b1dc39d99ea411eb0ed9c56f9975230907db5add3a1b4146cdf6f227c934052dab38a1937ed67d67585f28fb7410f10a1bec9dd5e4eb69d7253515  90-android-touch-dev.rules
"
